package org.jeecg.modules.wlhy.etcfeeclouds.controller;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.system.base.controller.JeecgController;
import org.jeecg.common.system.query.QueryGenerator;
import org.jeecg.modules.wlhy.etcfeeclouds.entity.HyEtcfeecloudsInvoice;
import org.jeecg.modules.wlhy.etcfeeclouds.service.IHyEtcfeecloudsInvoiceService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

 /**
 * @Description: hy_etcfeeclouds_invoice
 * @Author: duanlikao
 * @Date:   2021-09-07
 * @Version: V1.0
 */
@Api(tags="hy_etcfeeclouds_invoice")
@RestController
@RequestMapping("/etcfeecloudsinputinvoice/hyEtcfeecloudsInvoice")
@Slf4j
public class HyEtcfeecloudsInvoiceController extends JeecgController<HyEtcfeecloudsInvoice, IHyEtcfeecloudsInvoiceService> {
	@Autowired
	private IHyEtcfeecloudsInvoiceService hyEtcfeecloudsInvoiceService;

	/**
	 * 分页列表查询
	 *
	 * @param hyEtcfeecloudsInvoice
	 * @param pageNo
	 * @param pageSize
	 * @param req
	 * @return
	 */

	@ApiOperation(value="hy_etcfeeclouds_invoice-分页列表查询", notes="hy_etcfeeclouds_invoice-分页列表查询")
	@GetMapping(value = "/list")
	public Result<?> queryPageList(HyEtcfeecloudsInvoice hyEtcfeecloudsInvoice,
								   @RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
								   @RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
								   HttpServletRequest req) {
		QueryWrapper<HyEtcfeecloudsInvoice> queryWrapper = QueryGenerator.initQueryWrapper(hyEtcfeecloudsInvoice, req.getParameterMap());
		Page<HyEtcfeecloudsInvoice> page = new Page<HyEtcfeecloudsInvoice>(pageNo, pageSize);
		IPage<HyEtcfeecloudsInvoice> pageList = hyEtcfeecloudsInvoiceService.page(page, queryWrapper);
		return Result.OK(pageList);
	}
//
//	/**
//	 *   添加
//	 *
//	 * @param hyEtcfeecloudsInvoice
//	 * @return
//	 */
//	@AutoLog(value = "hy_etcfeeclouds_invoice-添加")
//	@ApiOperation(value="hy_etcfeeclouds_invoice-添加", notes="hy_etcfeeclouds_invoice-添加")
//	@PostMapping(value = "/add")
//	public Result<?> add(@RequestBody HyEtcfeecloudsInvoice hyEtcfeecloudsInvoice) {
//		hyEtcfeecloudsInvoiceService.save(hyEtcfeecloudsInvoice);
//		return Result.OK("添加成功！");
//	}
//
//	/**
//	 *  编辑
//	 *
//	 * @param hyEtcfeecloudsInvoice
//	 * @return
//	 */
//	@AutoLog(value = "hy_etcfeeclouds_invoice-编辑")
//	@ApiOperation(value="hy_etcfeeclouds_invoice-编辑", notes="hy_etcfeeclouds_invoice-编辑")
//	@PutMapping(value = "/edit")
//	public Result<?> edit(@RequestBody HyEtcfeecloudsInvoice hyEtcfeecloudsInvoice) {
//		hyEtcfeecloudsInvoiceService.updateById(hyEtcfeecloudsInvoice);
//		return Result.OK("编辑成功!");
//	}
//
//	/**
//	 *   通过id删除
//	 *
//	 * @param id
//	 * @return
//	 */
//	@AutoLog(value = "hy_etcfeeclouds_invoice-通过id删除")
//	@ApiOperation(value="hy_etcfeeclouds_invoice-通过id删除", notes="hy_etcfeeclouds_invoice-通过id删除")
//	@DeleteMapping(value = "/delete")
//	public Result<?> delete(@RequestParam(name="id",required=true) String id) {
//		hyEtcfeecloudsInvoiceService.removeById(id);
//		return Result.OK("删除成功!");
//	}
//
//	/**
//	 *  批量删除
//	 *
//	 * @param ids
//	 * @return
//	 */
//	@AutoLog(value = "hy_etcfeeclouds_invoice-批量删除")
//	@ApiOperation(value="hy_etcfeeclouds_invoice-批量删除", notes="hy_etcfeeclouds_invoice-批量删除")
//	@DeleteMapping(value = "/deleteBatch")
//	public Result<?> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
//		this.hyEtcfeecloudsInvoiceService.removeByIds(Arrays.asList(ids.split(",")));
//		return Result.OK("批量删除成功!");
//	}
//
	/**
	 * 通过id查询
	 *
	 * @param id
	 * @return
	 */
	@ApiOperation(value="hy_etcfeeclouds_invoice-通过id查询", notes="hy_etcfeeclouds_invoice-通过id查询")
	@GetMapping(value = "/queryById")
	public Result<?> queryById(@RequestParam(name="id",required=true) String id) {
		HyEtcfeecloudsInvoice hyEtcfeecloudsInvoice = hyEtcfeecloudsInvoiceService.getById(id);
		if(hyEtcfeecloudsInvoice==null) {
			return Result.error("未找到对应数据");
		}
		return Result.OK(hyEtcfeecloudsInvoice);
	}
//
//    /**
//    * 导出excel
//    *
//    * @param request
//    * @param hyEtcfeecloudsInvoice
//    */
//    @RequestMapping(value = "/exportXls")
//    public ModelAndView exportXls(HttpServletRequest request, HyEtcfeecloudsInvoice hyEtcfeecloudsInvoice) {
//        return super.exportXls(request, hyEtcfeecloudsInvoice, HyEtcfeecloudsInvoice.class, "hy_etcfeeclouds_invoice");
//    }
//
//    /**
//      * 通过excel导入数据
//    *
//    * @param request
//    * @param response
//    * @return
//    */
//    @RequestMapping(value = "/importExcel", method = RequestMethod.POST)
//    public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
//        return super.importExcel(request, response, HyEtcfeecloudsInvoice.class);
//    }

}
